﻿using System;
using System.Collections.Generic;
using System.Text;

namespace IM
{
    class IMProtocol
    {

        public Dictionary<String, IMContact> contacts = new Dictionary<String, IMContact>();

        public void addMessage(String chatName, String sender, 
                       HistoryToMail.MessageType type, String body, DateTime time)
        {
            IMContact contct;

            if (contacts.ContainsKey(chatName))
            {
                contct = contacts[chatName];
            }
            else
            {
                contct = new IMContact();
                contct.name = chatName;
                contacts[chatName] = contct;
            }
            contct.addMessage(sender, type, body, time);
        }
    }
}
